<?php 
exit;
set_time_limit(0);
include '../c/config.php';
 

$dbhost='121.41.208.81';
$mysqliZ = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
if (!$mysqliZ->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqli->error);}

$query=$mysqliZ->query("select phone from z_uf where ischong is NULL group by phone having count(phone) >1 ");
$openid=array();
while ($list=$query->fetch_assoc()){
    $openid[$list['phone']]=$list['phone'];
}
echo count($openid);
echo "<br /><br />";

foreach ($openid as $v){
    $query=$mysqliZ->query("select * from z_uf where phone='".$v."' order by fen desc ");
    $tmpFen=0;
    $tmpId=1;
    $tmpName='';
    $tmpidcard='';
    $openid='';
    while ($list=$query->fetch_assoc()){
        print_r($list);
        echo "<br />";
        if(1 == $tmpId){
            $tmpFen=$list['fen'];
            $tmpName=trim($list['name']);
            $tmpidcard=trim($list['idcard']);
            $openid=trim($list['openid']);
        }
        if($tmpId > 1 && $list['name'] == $tmpName && $list['idcard'] == $tmpidcard && $openid == $list['openid']
          ){
                echo "<br />";
            echo '..........chongdie...........';
            echo "<br />";
            $mysqliZ->query("update z_uf set ischong=1 where id='".$list['id']."' ");
            $mysqliZ->query("update z_uf SET `fen-dx` = NULL, `fen-duo` = NULL, `fen-pan` = NULL  where openid='".$openid."' ");
        }
        $tmpId++;
    }
    echo $tmpId,'------------------------- end';
    echo "<br /><br />";
}

